package com.example.travelhelper.controller;

import com.example.travelhelper.pojo.Article;
import com.example.travelhelper.service.ArticleService;
import com.example.travelhelper.utils.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/article")
@CrossOrigin
public class ArticleController {
@Autowired
    ArticleService articleService;
   @PostMapping("submit")
    public ResponseData add(@RequestBody  Article article){
       System.out.println(article);
       articleService.submit(article);
       return ResponseData.success("提交成功");
    }


    @GetMapping("get")
    public ResponseData update(){
   return articleService.get();
    }
}
